#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <aclconio.h>
#include <define.h>
#include <transact.h>
#include <tran.h>
#include <gds.h>
#include <sizes.h>
#include "ConfProto.h"
#include "tblutil.h"
#include <\SOFTPAY\Ver30\source\include\sizes.h>
#include <\SOFTPAY\Ver30\HostSrc\citisrc\citiids.h>
#include <\SOFTPAY\Ver30\HostSrc\cpacsrc\cpacids.h>
#include <confio.h>

#include <\SOFTPAY\Ver30\source\include\CTL.h>

char allowLinkActive=1;

const char*CTLName = "CTL.dat";

static CTL_REC srCTLRec;

static int recordNum;
int	inLoadCTLRec (int inRecNumber)
{
	int inRet;

	inRet = inLoadConfRec(CTL_FILENAME, SIZE_CTL_REC, inRecNumber, (char *) &srCTLRec);

	recordNum = inRecNumber;
	return inRet;
}

void *pvdGetCTLRec(void)
{
	return &srCTLRec;

}

int	inSaveCTLRec (int inRecNumber)
{
	int inRet;

	inRet = inSaveConfRec(CTL_FILENAME, SIZE_CTL_REC, inRecNumber, (char *) &srCTLRec);

	return inRet;
}

int	inGetCTLRecNumber (void)
{
	return recordNum;
}

int	inUpdateCTLRec (void)
{
	int inRet;

	inRet = inSaveConfRec(CTL_FILENAME, SIZE_CTL_REC, recordNum, (char *) &srCTLRec);

	return inRet;
}

void	vdResetCTLRec (void)
{
	memset((void*)&srCTLRec, 0, REC_SIZEOF(srCTLRec));
}

short shGetImamCTLIndex(void)
{
	return srCTLRec.shImamCTLIndex;
}

void vdSetImamCTLIndex(short shImamCTLIndex)
{
	srCTLRec.shImamCTLIndex = shImamCTLIndex;
}

short shGetImamCTLType(void)
{
	return srCTLRec.shImamCTLType;
}

void vdSetImamCTLType(short shImamCTLType)
{
	srCTLRec.shImamCTLType = shImamCTLType;
}

char* szGetImamCTLPosEntryMode(void)
{
	return srCTLRec.szImamCTLPosEntryMode;
}

void vdSetImamCTLPosEntryMode(const char* szImamCTLPosEntryMode)
{
	strNumCopy(srCTLRec.szImamCTLPosEntryMode, szImamCTLPosEntryMode, sizeof(((CTL_REC*)NULL)->szImamCTLPosEntryMode)-1);
}

short shGetImamCTLComPort(void)
{
	return srCTLRec.shImamCTLComPort;
}

void vdSetImamCTLComPort(short shImamCTLComPort)
{
	srCTLRec.shImamCTLComPort = shImamCTLComPort;
}

char* szGetImamCTLBaudRate(void)
{
	return srCTLRec.szImamCTLBaudRate;
}

void vdSetImamCTLBaudRate(const char* szImamCTLBaudRate)
{
	strNumCopy(srCTLRec.szImamCTLBaudRate, szImamCTLBaudRate, sizeof(((CTL_REC*)NULL)->szImamCTLBaudRate)-1);
}

char* szGetImamCTLBaseUnitIndex(void)
{
	return srCTLRec.szImamCTLBaseUnitIndex;
}

void vdSetImamCTLBaseUnitIndex(const char* szImamCTLBaseUnitIndex)
{
	strNumCopy(srCTLRec.szImamCTLBaseUnitIndex, szImamCTLBaseUnitIndex, sizeof(((CTL_REC*)NULL)->szImamCTLBaseUnitIndex)-1);
}

char* szGetImamCTLReaderUnitIndex(void)
{
	return srCTLRec.szImamCTLReaderUnitIndex;
}

void vdSetImamCTLReaderUnitIndex(const char* szImamCTLReaderUnitIndex)
{
	strNumCopy(srCTLRec.szImamCTLReaderUnitIndex, szImamCTLReaderUnitIndex, sizeof(((CTL_REC*)NULL)->szImamCTLReaderUnitIndex)-1);
}

char* szGetImamCTLImekMdk(void)
{
	return srCTLRec.szImamCTLImekMdk;
}

void vdSetImamCTLImekMdk(const char* szImamCTLImekMdk)
{
	strNumCopy(srCTLRec.szImamCTLImekMdk, szImamCTLImekMdk, sizeof(((CTL_REC*)NULL)->szImamCTLImekMdk)-1);
}

char* szGetImamCTLImek(void)
{
	return srCTLRec.szImamCTLImek;
}

void vdSetImamCTLImek(const char* szImamCTLImek)
{
	strNumCopy(srCTLRec.szImamCTLImek, szImamCTLImek, sizeof(((CTL_REC*)NULL)->szImamCTLImek)-1);
}

char* szGetImamCTLMek(void)
{
	return srCTLRec.szImamCTLMek;
}

void vdSetImamCTLMek(const char* szImamCTLMek)
{
	strNumCopy(srCTLRec.szImamCTLMek, szImamCTLMek, sizeof(((CTL_REC*)NULL)->szImamCTLMek)-1);
}

char* szGetImamCTLIaekMdk(void)
{
	return srCTLRec.szImamCTLIaekMdk;
}

void vdSetImamCTLIaekMdk(const char* szImamCTLIaekMdk)
{
	strNumCopy(srCTLRec.szImamCTLIaekMdk, szImamCTLIaekMdk, sizeof(((CTL_REC*)NULL)->szImamCTLIaekMdk)-1);
}

char* szGetImamCTLIaek(void)
{
	return srCTLRec.szImamCTLIaek;
}

void vdSetImamCTLIaek(const char* szImamCTLIaek)
{
	strNumCopy(srCTLRec.szImamCTLIaek, szImamCTLIaek, sizeof(((CTL_REC*)NULL)->szImamCTLIaek)-1);
}

char* szGetImamCTLAek(void)
{
	return srCTLRec.szImamCTLAek;
}

void vdSetImamCTLAek(const char* szImamCTLAek)
{
	strNumCopy(srCTLRec.szImamCTLAek, szImamCTLAek, sizeof(((CTL_REC*)NULL)->szImamCTLAek)-1);
}

char* szGetImamCTLIckSession(void)
{
	return srCTLRec.szImamCTLIckSession;
}

void vdSetImamCTLIckSession(const char* szImamCTLIckSession)
{
	strNumCopy(srCTLRec.szImamCTLIckSession, szImamCTLIckSession, sizeof(((CTL_REC*)NULL)->szImamCTLIckSession)-1);
}

char* szGetImamCTLMSession(void)
{
	return srCTLRec.szImamCTLMSession;
}

void vdSetImamCTLMSession(const char* szImamCTLMSession)
{
	strNumCopy(srCTLRec.szImamCTLMSession, szImamCTLMSession, sizeof(((CTL_REC*)NULL)->szImamCTLMSession)-1);
}

char* szGetImamCTLASession(void)
{
	return srCTLRec.szImamCTLASession;
}

void vdSetImamCTLASession(const char* szImamCTLASession)
{
	strNumCopy(srCTLRec.szImamCTLASession, szImamCTLASession, sizeof(((CTL_REC*)NULL)->szImamCTLASession)-1);
}

short shGetImamCTLMagStripe(void)
{
	return srCTLRec.shImamCTLMagStripe;
}

void vdSetImamCTLMagStripe(short shImamCTLMagStripe)
{
	srCTLRec.shImamCTLMagStripe = shImamCTLMagStripe;
}

char* szGetImamCTLPaymentScheme(void)
{
	return srCTLRec.szImamCTLPaymentScheme;
}

void vdSetImamCTLPaymentScheme(const char* szImamCTLPaymentScheme)
{
	strNumCopy(srCTLRec.szImamCTLPaymentScheme, szImamCTLPaymentScheme, sizeof(((CTL_REC*)NULL)->szImamCTLPaymentScheme)-1);
}

char* szGetImamCTLReaderCVM(void)
{
	return srCTLRec.szImamCTLReaderCVM;
}

void vdSetImamCTLReaderCVM(const char* szImamCTLReaderCVM)
{
	strNumCopy(srCTLRec.szImamCTLReaderCVM, szImamCTLReaderCVM, sizeof(((CTL_REC*)NULL)->szImamCTLReaderCVM)-1);
}

char* szGetImamCTLDF04_CVMReq(void)
{
	return srCTLRec.szImamCTLDF04_CVMReq;
}

void vdSetImamCTLDF04_CVMReq(const char* szImamCTLDF04_CVMReq)
{
	strNumCopy(srCTLRec.szImamCTLDF04_CVMReq, szImamCTLDF04_CVMReq, sizeof(((CTL_REC*)NULL)->szImamCTLDF04_CVMReq)-1);
}

char* szGetImamCTL9F66_CVM_TTQ(void)
{
	return srCTLRec.szImamCTL9F66_CVM_TTQ;
}

void vdSetImamCTL9F66_CVM_TTQ(const char* szImamCTL9F66_CVM_TTQ)
{
	strNumCopy(srCTLRec.szImamCTL9F66_CVM_TTQ, szImamCTL9F66_CVM_TTQ, sizeof(((CTL_REC*)NULL)->szImamCTL9F66_CVM_TTQ)-1);
}

char* szGetImamCTL9F35_TermType(void)
{
	return srCTLRec.szImamCTL9F35_TermType;
}

void vdSetImamCTL9F35_TermType(const char* szImamCTL9F35_TermType)
{
	strNumCopy(srCTLRec.szImamCTL9F35_TermType, szImamCTL9F35_TermType, sizeof(((CTL_REC*)NULL)->szImamCTL9F35_TermType)-1);
}

char* szGetImamCTL9F1A_TCountry(void)
{
	return srCTLRec.szImamCTL9F1A_TCountry;
}

void vdSetImamCTL9F1A_TCountry(const char* szImamCTL9F1A_TCountry)
{
	strNumCopy(srCTLRec.szImamCTL9F1A_TCountry, szImamCTL9F1A_TCountry, sizeof(((CTL_REC*)NULL)->szImamCTL9F1A_TCountry)-1);
}

char* szGetImamCTL5F2A_TCurrency(void)
{
	return srCTLRec.szImamCTL5F2A_TCurrency;
}

void vdSetImamCTL5F2A_TCurrency(const char* szImamCTL5F2A_TCurrency)
{
	strNumCopy(srCTLRec.szImamCTL5F2A_TCurrency, szImamCTL5F2A_TCurrency, sizeof(((CTL_REC*)NULL)->szImamCTL5F2A_TCurrency)-1);
}

char* szGetImamCTL9C_TrxType(void)
{
	return srCTLRec.szImamCTL9C_TrxType;
}

void vdSetImamCTL9C_TrxType(const char* szImamCTL9C_TrxType)
{
	strNumCopy(srCTLRec.szImamCTL9C_TrxType, szImamCTL9C_TrxType, sizeof(((CTL_REC*)NULL)->szImamCTL9C_TrxType)-1);
}

char* szGetImamCTLDF03_fDDA(void)
{
	return srCTLRec.szImamCTLDF03_fDDA;
}

void vdSetImamCTLDF03_fDDA(const char* szImamCTLDF03_fDDA)
{
	strNumCopy(srCTLRec.szImamCTLDF03_fDDA, szImamCTLDF03_fDDA, sizeof(((CTL_REC*)NULL)->szImamCTLDF03_fDDA)-1);
}

char* szGetImamCTLDF05_OffFund(void)
{
	return srCTLRec.szImamCTLDF05_OffFund;
}

void vdSetImamCTLDF05_OffFund(const char* szImamCTLDF05_OffFund)
{
	strNumCopy(srCTLRec.szImamCTLDF05_OffFund, szImamCTLDF05_OffFund, sizeof(((CTL_REC*)NULL)->szImamCTLDF05_OffFund)-1);
}

char* szGetImamCTLDF00_TrxLimit(void)
{
	return srCTLRec.szImamCTLDF00_TrxLimit;
}

void vdSetImamCTLDF00_TrxLimit(const char* szImamCTLDF00_TrxLimit)
{
	strNumCopy(srCTLRec.szImamCTLDF00_TrxLimit, szImamCTLDF00_TrxLimit, sizeof(((CTL_REC*)NULL)->szImamCTLDF00_TrxLimit)-1);
}

char* szGetImamCTLDF01_CvmLimit(void)
{
	return srCTLRec.szImamCTLDF01_CvmLimit;
}

void vdSetImamCTLDF01_CvmLimit(const char* szImamCTLDF01_CvmLimit)
{
	strNumCopy(srCTLRec.szImamCTLDF01_CvmLimit, szImamCTLDF01_CvmLimit, sizeof(((CTL_REC*)NULL)->szImamCTLDF01_CvmLimit)-1);
}

char* szGetImamCTLDF02_FloorLimit(void)
{
	return srCTLRec.szImamCTLDF02_FloorLimit;
}

void vdSetImamCTLDF02_FloorLimit(const char* szImamCTLDF02_FloorLimit)
{
	strNumCopy(srCTLRec.szImamCTLDF02_FloorLimit, szImamCTLDF02_FloorLimit, sizeof(((CTL_REC*)NULL)->szImamCTLDF02_FloorLimit)-1);
}

